<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets" template="/home.xhtml">
	<ui:define name="corpo">
		<h:form prependId="false">
			<p:panel header="Administrar Funcionários" style="background: #dbfbda;font-size:15px;min-height:700px;margin-top:10px;float:left;width:99%">
				<h:panelGroup style="float: left;width:250px;" layout="block">
					<ui:include src="menu.xhtml" />					    
				</h:panelGroup>
				<h:panelGroup layout="block" style="float:left">
				    	<p:dataTable var="funcionario" value="#{manterAdministradorBean.administradorForm.funcionarios}" id="table_funcionario" emptyMessage="Nenhum registro encontrado." paginator="true" rows="15"  
				                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}" 
				                 paginatorPosition="bottom" style="width:700px">  
					  
				            <f:facet name="header">  
				                <h:outputText value="Funcionários Cadastrados" />
				            </f:facet>  
					        <p:column>  
					            <f:facet name="header">  
					                <h:outputText value="Funcionário" />  
					            </f:facet>  
					            <h:outputText value="#{funcionario.nome}" />  
					        </p:column>  

					        <p:column>  
					            <f:facet name="header">  
					                <h:outputText value="Cargo" />  
					            </f:facet>  
					            <h:outputText value="#{funcionario.cargo.cargo}" />  
					        </p:column> 
					         
					        <p:column>  
					            <f:facet name="header">  
					                <h:outputText value="Status" />  
					            </f:facet>  
					            <h:outputText value="#{funcionario.status.status}" />  
					        </p:column>  
					  
					        <p:column style="text-align: center">  
					            <f:facet name="header">  
					                <h:outputText value="Excluir" />  
					            </f:facet>  
					            <p:commandButton image="ui-icon ui-icon-trash" oncomplete="excluir.show()">
					            	<f:setPropertyActionListener target="#{manterFuncionarioBean.funcionario}" value="#{funcionario}" />
					            </p:commandButton>  
					        </p:column>  
	
					        <p:column style="text-align: center">  
					            <f:facet name="header">  
					                <h:outputText value="Editar" />  
					            </f:facet>  
					            <p:commandButton image="ui-icon ui-icon-transferthick-e-w" oncomplete="editar.show()" update="pnl_edit">
					            	<f:setPropertyActionListener target="#{manterFuncionarioBean.funcionario}" value="#{funcionario}" />					            	
					            </p:commandButton>
					        </p:column>  
					  
					  		<f:facet name="footer">
				                <p:commandButton value="Cadastrar" image="ui-icon ui-icon-circle-plus" style="position: relative; right: 290px;" oncomplete="cadastrar.show()" action="#{manterFuncionarioBean.limparCampo}" update="pnl_cadastro" />
				            </f:facet>
					    </p:dataTable>
				</h:panelGroup>
			 
			</p:panel>
			
		</h:form>
		
		<ui:include src="modal_excluir_admin.xhtml">
			<ui:param name="bean" value="#{manterFuncionarioBean}" />
			<ui:param name="metodo" value="excluir" />
			<ui:param name="idTabela" value="table_funcionario" />
		</ui:include>
		
		<p:dialog header="Editar" widgetVar="editar" resizable="false" modal="true" width="600" showEffect="clip" hideEffect="fold">
			<h:form prependId="false">

				<h:panelGrid columns="2" cellpadding="5" cellspacing="0" id="pnl_edit">
			
					<h:outputLabel value="#{msg['display.label.funcionario.nome']}" for="nome" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputText value="#{manterFuncionarioBean.funcionario.nome}" size="50" maxlength="100" required="true" label="nome" id="nome" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="nome" id="msgNome" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.cpf']}" for="cpf" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputMask value="#{manterFuncionarioBean.funcionario.cpf}" mask="999.999.999-99" size="14" maxlength="14" required="true" label="cpf" id="cpf" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro">
							<f:converter converterId="com.automed.cpfConverter"/>
							<f:validator validatorId="com.automed.cpfValidator"/>
						</p:inputMask>
					</p:inplace>
					<h:outputText />
					<h:message for="cpf" id="msgCPF" styleClass="msg_erro_required"/>
					
					<h:outputLabel value="#{msg['display.label.funcionario.rg']}" for="rg" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputMask value="#{manterFuncionarioBean.funcionario.rg}" mask="99.999.999-9" size="12" maxlength="12" required="true" label="rg" id="rg" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="rg" id="msgRG" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.login']}" for="login" styleClass="fmt_label_form_cadastro" />
					<p:inplace disabled="true" label="***">
						<p:inputText value="#{manterFuncionarioBean.funcionario.login}" size="10" maxlength="50" required="true" label="login" id="login" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="login" id="msgLogin" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.senha']}" for="senha" styleClass="fmt_label_form_cadastro" />
					<p:inplace disabled="true" label="***">
						<p:password value="#{manterFuncionarioBean.funcionario.senha}" promptLabel="Por favor, digite sua senha" weakLabel="Fraca" goodLabel="Média" strongLabel="Forte" size="10" maxlength="20" required="true" style="border: solid 1px #5FA03F;background-color: #FFF;" label="senha" id="senha" password="true" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="senha" id="msgSenha" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.email']}" for="email" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputText value="#{manterFuncionarioBean.funcionario.email}" size="50" maxlength="50" required="true" label="email" id="email" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro">
							<f:validator validatorId="com.automed.emailValidator"/>
						</p:inputText>
					</p:inplace>
					<h:outputText />
					<h:message for="email" id="msgEmail" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.status']}" for="status" styleClass="fmt_label_form_cadastro" />
					<p:inplace label="#{manterFuncionarioBean.funcionario.status.status}">
						<h:selectOneMenu value="#{manterFuncionarioBean.funcionario.status}" id="status" style="font-size:12px">
							<f:selectItem itemLabel="" noSelectionOption="true" />
							<f:selectItems value="#{manterFuncionarioBean.funcionarioForm.status}" var="entity" itemLabel="#{entity.status}" itemValue="#{entity}" />
						</h:selectOneMenu>
					</p:inplace>
					<h:outputText />
					<h:message for="status" id="msgStatus" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.clinica']}" for="clinica" styleClass="fmt_label_form_cadastro" />
					<p:inplace label="#{manterFuncionarioBean.funcionario.clinica.clinica}">
						<h:selectOneMenu value="#{manterFuncionarioBean.funcionario.clinica}" id="clinica" style="font-size:12px">
							<f:selectItem itemLabel="" noSelectionOption="true" />
							<f:selectItems value="#{manterFuncionarioBean.funcionarioForm.clinicas}" var="entity" itemLabel="#{entity.clinica}" itemValue="#{entity}" />
						</h:selectOneMenu>
					</p:inplace>
					<h:outputText />
					<h:message for="clinica" id="msgClinica" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.cargo']}" for="cargo" styleClass="fmt_label_form_cadastro" />
					<p:inplace label="#{manterFuncionarioBean.funcionario.cargo.cargo}">
						<h:selectOneMenu value="#{manterFuncionarioBean.funcionario.cargo}" id="cargo" style="font-size:12px">
							<f:selectItem itemLabel="" noSelectionOption="true" />
							<f:selectItems value="#{manterFuncionarioBean.funcionarioForm.cargos}" var="entity" itemLabel="#{entity.cargo}" itemValue="#{entity}" />
						</h:selectOneMenu>
					</p:inplace>
					<h:outputText />
					<h:message for="cargo" id="msgCargo" styleClass="msg_erro_required"/>
					
					<ui:repeat var="entity" value="#{manterFuncionarioBean.funcionario.telefones}">
						<h:outputLabel value="#{entity.tipoTelefone.tipo eq 'Celular' ? 'Celular: ' : (entity.tipoTelefone.tipo eq 'Comercial' ? 'Comercial: ' : (entity.tipoTelefone.tipo eq 'Residencial' ? 'Residencial: ' : ''))}" for="tel1" styleClass="fmt_label_form_cadastro" />
						<p:inplace emptyLabel="Adicionar">
							<p:inputMask value="#{entity.telefone}" mask="(99)9999-9999" required="#{entity.tipoTelefone.tipo eq 'Residencial'}" label="#{entity.tipoTelefone.tipo eq 'Celular' ? 'Celular' : (entity.tipoTelefone.tipo eq 'Comercial' ? 'Comercial' : (entity.tipoTelefone.tipo eq 'Residencial' ? 'Residencial' : ''))}" id="tel1" size="13" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
						</p:inplace>
						<h:outputText />
						<h:message for="tel1" id="msgTEL1" styleClass="msg_erro_required"/>
						<br/>
					</ui:repeat>
					
					<h:outputLabel value="#{msg['display.label.funcionario.bairro']}" for="bairro" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputText value="#{manterFuncionarioBean.funcionario.endereco.bairro}" required="true" size="50" maxlength="100" label="bairro" id="bairro" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="bairro" id="msgBairro" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.cep']}" for="cep" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputMask value="#{manterFuncionarioBean.funcionario.endereco.cep}" mask="99999-999" size="9" maxlength="8" required="true" label="cep" id="cep" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="cep" id="msgCEP" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.complemento']}" for="complemento" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputText value="#{manterFuncionarioBean.funcionario.endereco.complemento}" required="true" size="50" maxlength="50" label="complemento" id="complemento" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="complemento" id="msgComplemento" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.logradouro']}" for="logradouro" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputText value="#{manterFuncionarioBean.funcionario.endereco.endereco}" required="true" size="50" maxlength="100" label="logradouro" id="logradouro" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="logradouro" id="msgLogradouro" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.numero']}" for="numero" styleClass="fmt_label_form_cadastro" />
					<p:inplace>
						<p:inputMask value="#{manterFuncionarioBean.funcionario.endereco.numero}" required="true" mask="?999999" size="6" label="numero" id="numero" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					</p:inplace>
					<h:outputText />
					<h:message for="numero" id="msgNumero" styleClass="msg_erro_required" />
				
					<h:outputLabel value="#{msg['display.label.funcionario.cidade']}" for="cidade" styleClass="fmt_label_form_cadastro" />
					<p:inplace label="#{manterFuncionarioBean.funcionario.endereco.cidade.cidade}">
						<h:selectOneMenu value="#{manterFuncionarioBean.funcionario.endereco.cidade}" id="cidade" style="font-size:12px">
							<f:selectItem itemLabel="" noSelectionOption="true" />
							<f:selectItems value="#{manterFuncionarioBean.funcionarioForm.cidades}" var="entity" itemLabel="#{entity.cidade}" itemValue="#{entity}" />
						</h:selectOneMenu>
					</p:inplace>
					<h:outputText />
					<h:message for="cidade" id="msgCidade" styleClass="msg_erro_required"/>
						
				</h:panelGrid>
				<h:panelGroup style="padding-top: 20px;padding-bottom:10px;text-align:center" layout="block">
					<p:commandButton value="#{msg['display.view.adm.salvar']}" action="#{manterFuncionarioBean.editar}" oncomplete="validaEdicao();" update="pnl_edit, table_funcionario, func_javascript"/>
					<p:commandButton value="#{msg['display.view.adm.cancelar']}" oncomplete="editar.hide()"/>
				</h:panelGroup>

			</h:form>
	    </p:dialog>
	    
		<p:dialog header="Cadastrar" widgetVar="cadastrar" resizable="false" modal="true" width="600" showEffect="clip" hideEffect="fold">
			<h:form prependId="false">
				
				<h:panelGrid columns="2" cellpadding="5" cellspacing="0" id="pnl_cadastro">
			
					<h:outputLabel value="#{msg['display.label.funcionario.nome']}" for="nomeCad" styleClass="fmt_label_form_cadastro" />
					<p:inputText value="#{manterFuncionarioBean.funcionario.nome}" size="50" maxlength="100" required="true" label="nome" id="nomeCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="nomeCad" id="msgNomeCad" styleClass="msg_erro_required"/>
					
					<h:outputLabel value="#{msg['display.label.funcionario.cpf']}" for="cpfCad" styleClass="fmt_label_form_cadastro" />
					<p:inputMask value="#{manterFuncionarioBean.funcionario.cpf}" mask="999.999.999-99" size="14" maxlength="14" required="true" label="cpf" id="cpfCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro">
						<f:converter converterId="com.automed.cpfConverter"/>
						<f:validator validatorId="com.automed.cpfValidator"/>
						<f:validator validatorId="com.automed.cpfValidatorExistente"/>
					</p:inputMask>
					<h:outputText />
					<h:message for="cpfCad" id="msgCPFCad" styleClass="msg_erro_required"/>
					
					<h:outputLabel value="#{msg['display.label.funcionario.rg']}" for="rgCad" styleClass="fmt_label_form_cadastro" />
					<p:inputMask value="#{manterFuncionarioBean.funcionario.rg}" mask="99.999.999-9" size="12" maxlength="12" required="true" label="rg" id="rgCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="rgCad" id="msgRGCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.login']}" for="loginCad" styleClass="fmt_label_form_cadastro" />
					<p:inputText value="#{manterFuncionarioBean.funcionario.login}" size="10" maxlength="50" required="true" label="login" id="loginCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="loginCad" id="msgLoginCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.senha']}" for="senhaCad" styleClass="fmt_label_form_cadastro" />
					<p:password value="#{manterFuncionarioBean.funcionario.senha}" promptLabel="Por favor, digite sua senha" weakLabel="Fraca" goodLabel="Média" strongLabel="Forte" size="10" maxlength="20" required="true" style="border: solid 1px #5FA03F;background-color: #FFF;" label="senha" id="senhaCad" password="true" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="senhaCad" id="msgSenhaCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.email']}" for="emailCad" styleClass="fmt_label_form_cadastro" />
					<p:inputText value="#{manterFuncionarioBean.funcionario.email}" size="50" maxlength="50" required="true" label="email" id="emailCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro">
						<f:validator validatorId="com.automed.emailValidator"/>
					</p:inputText>
					<h:outputText />
					<h:message for="emailCad" id="msgEmailCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.status']}" for="statusCad" styleClass="fmt_label_form_cadastro" />
					<h:selectOneMenu value="#{manterFuncionarioBean.funcionario.status}" id="statusCad" style="font-size:12px">
						<f:selectItem itemLabel="" noSelectionOption="true" />
						<f:selectItems value="#{manterFuncionarioBean.funcionarioForm.status}" var="entity" itemLabel="#{entity.status}" itemValue="#{entity}" />
					</h:selectOneMenu>
					<h:outputText />
					<h:message for="statusCad" id="msgStatusCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.clinica']}" for="clinicaCad" styleClass="fmt_label_form_cadastro" />
					<h:selectOneMenu value="#{manterFuncionarioBean.funcionario.clinica}" id="clinicaCad" style="font-size:12px">
						<f:selectItem itemLabel="" noSelectionOption="true" />
						<f:selectItems value="#{manterFuncionarioBean.funcionarioForm.clinicas}" var="entity" itemLabel="#{entity.clinica}" itemValue="#{entity}" />
					</h:selectOneMenu>
					<h:outputText />
					<h:message for="clinicaCad" id="msgClinicaCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.cargo']}" for="cargoCad" styleClass="fmt_label_form_cadastro" />
					<h:selectOneMenu value="#{manterFuncionarioBean.funcionario.cargo}" id="cargoCad" style="font-size:12px">
						<f:selectItem itemLabel="" noSelectionOption="true" />
						<f:selectItems value="#{manterFuncionarioBean.funcionarioForm.cargos}" var="entity" itemLabel="#{entity.cargo}" itemValue="#{entity}" />
					</h:selectOneMenu>
					<h:outputText />
					<h:message for="cargoCad" id="msgCargoCad" styleClass="msg_erro_required"/>
					
					<h:outputLabel value="#{msg['display.label.funcionario.tel1']}" for="tel1Cad" styleClass="fmt_label_form_cadastro" />
					<p:inputMask value="#{manterFuncionarioBean.residencial.telefone}" mask="(99)9999-9999"  required="true" label="Residencial" id="tel1Cad" size="13" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="tel1Cad" id="msgTEL1Cad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.tel2']}" for="tel2Cad" styleClass="fmt_label_form_cadastro" />
					<p:inputMask value="#{manterFuncionarioBean.celular.telefone}" mask="(99)9999-9999" label="Celular" id="tel2Cad" size="13" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="tel2Cad" id="msgTEL2Cad" />

					<h:outputLabel value="#{msg['display.label.funcionario.tel3']}" for="tel3Cad" styleClass="fmt_label_form_cadastro" />
					<p:inputMask value="#{manterFuncionarioBean.comercial.telefone}" mask="(99)9999-9999" label="Comercial" id="tel3Cad" size="13" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="tel3Cad" id="msgTEL3Cad" />
					
					<h:outputLabel value="#{msg['display.label.funcionario.bairro']}" for="bairroCad" styleClass="fmt_label_form_cadastro" />
					<p:inputText value="#{manterFuncionarioBean.funcionario.endereco.bairro}" required="true" size="50" maxlength="100" label="bairro" id="bairroCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="bairroCad" id="msgBairroCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.cep']}" for="cepCad" styleClass="fmt_label_form_cadastro" />
					<p:inputMask value="#{manterFuncionarioBean.funcionario.endereco.cep}" mask="99999-999" size="9" maxlength="8" required="true" label="cep" id="cepCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="cepCad" id="msgCEPCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.complemento']}" for="complementoCad" styleClass="fmt_label_form_cadastro" />
					<p:inputText value="#{manterFuncionarioBean.funcionario.endereco.complemento}" required="true" size="50" maxlength="50" label="complemento" id="complementoCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="complementoCad" id="msgComplementoCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.logradouro']}" for="logradouroCad" styleClass="fmt_label_form_cadastro" />
					<p:inputText value="#{manterFuncionarioBean.funcionario.endereco.endereco}" required="true" size="50" maxlength="100" label="logradouro" id="logradouroCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="logradouroCad" id="msgLogradouroCad" styleClass="msg_erro_required"/>

					<h:outputLabel value="#{msg['display.label.funcionario.numero']}" for="numeroCad" styleClass="fmt_label_form_cadastro" />
					<p:inputMask value="#{manterFuncionarioBean.funcionario.endereco.numero}" required="true" mask="?999999" size="6" label="numero" id="numeroCad" style="border: solid 1px #5FA03F;background-color: #FFF;" styleClass="fmt_input_form_cadastro" />
					<h:outputText />
					<h:message for="numeroCad" id="msgNumeroCad" styleClass="msg_erro_required" />
				
					<h:outputLabel value="#{msg['display.label.funcionario.cidade']}" for="cidadeCad" styleClass="fmt_label_form_cadastro" />
					<h:selectOneMenu value="#{manterFuncionarioBean.funcionario.endereco.cidade}" id="cidadeCad" style="font-size:12px">
						<f:selectItem itemLabel="" noSelectionOption="true" />
						<f:selectItems value="#{manterFuncionarioBean.funcionarioForm.cidades}" var="entity" itemLabel="#{entity.cidade}" itemValue="#{entity}" />
					</h:selectOneMenu>
					<h:outputText />
					<h:message for="cidadeCad" id="msgCidadeCad" styleClass="msg_erro_required"/>
						
				</h:panelGrid>
				<h:panelGroup style="padding-top: 20px;padding-bottom:10px;text-align:center" layout="block">
					<p:commandButton value="#{msg['display.view.adm.salvar']}" action="#{manterFuncionarioBean.cadastrar}" oncomplete="validaCadastro();" update="pnl_cadastro, table_funcionario, func_javascript"/>
					<p:commandButton value="#{msg['display.view.adm.cancelar']}" onclick="cadastrar.hide()"/>
				</h:panelGroup>
				
				<p:outputPanel id="func_javascript">
					<script type="text/javascript">
	
						function validaCadastro(){
							if(#{!empty requestScope.cadastrado}){
								cadastrar.hide();
							}
						}
										
						function validaEdicao(){
							if(#{!empty requestScope.editado}){
								editar.hide();
							}
						}						
								
					</script>
				</p:outputPanel>
				
			</h:form>
			
	    </p:dialog>
		
	</ui:define>
</ui:composition>